<template>
  <el-dialog v-model="dialogFormVisible" :title="dialogFormTitle">
    <el-form :model="formdata">
      <el-form-item label="城市" :label-width="formLabelWidth">
        <el-input v-model="formdata.city" autocomplete="off" />
      </el-form-item>
      <el-form-item label="车站名称" :label-width="formLabelWidth">
        <el-input v-model="formdata.snm" autocomplete="off" />
      </el-form-item>
    </el-form>

    <template #footer>
      <span class="dialog-footer">
        <el-button @click="dialogFormVisible = false">Cancel</el-button>
        <el-button type="primary" :icon="Promotion" @click="stationStore.save"> 保存 </el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script setup>
import { storeToRefs } from 'pinia'

import { Promotion } from '@element-plus/icons-vue'
import { useStationStore } from '../../stores/station'

const stationStore = useStationStore()

const { dialogFormVisible, dialogFormTitle, formdata } = storeToRefs(stationStore)

const formLabelWidth = '140px'
</script>
<style scoped>
.el-button--text {
  margin-right: 15px;
}
.el-select {
  width: 300px;
}
.el-input {
  width: 300px;
}
.dialog-footer button:first-child {
  margin-right: 10px;
}
</style>
